Skip to content

BASH: Clean up, Compartmentalize, and auto-detect if in project root.#1

Open
TheFlagCourier wants to merge 3 commits intoGodotCommunityGamesOrg:mainfrom
TheFlagCourier:main
Open

BASH: Clean up, Compartmentalize, and auto-detect if in project root.#1
TheFlagCourier wants to merge 3 commits intoGodotCommunityGamesOrg:mainfrom
TheFlagCourier:main

Conversation

@TheFlagCourier
Copy link
Copy Markdown

This PR started as a simple ShellCheck revision, but ballooned to include moving portions into function calls, and removing the user confirmation step.

Benefits:

  • The script can now be run headless, or extended to by other scripts, without requiring (or potentially hanging onto) user input.
  • The script now exits with an error code of 1 if it is not executed in a project root. (0 reserved for success)
  • Removing the cd commands reduces disk read operations (negligible), and had room for potential issues.
  • Moving sections to specific functions can help with collapsing sections in an editor/viewer.
    • Additionally, this opens the user to call functions directly from the script, if sourced. ( source {script}.sh; {function_name} )
    • In the future, if re-implementing an interactive mode, the user could use arguments to only call the functions they need/want. ( e.g. {script}.sh --no-addons)

Also updates the README.md

Also:
	- Validate with ShellCheck (Mainly reduce globbing)
	- Remove unnecessary directory access jumps with `cd` - `mkdir` should be enough.
	- Replace Read Parsing with automatic file checking
		- Checks for presence of `project.godot` file to determine if it is in a project root.
	- Change exit code for to non-zero value if not in a project root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant